﻿using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Xml.Serialization;
using Microsoft.SharePoint.WebPartPages;

namespace Ordina.SharePoint.FacebookLike.FacebookLikeWebPart
{
    [ToolboxItemAttribute(false)]
    public class FacebookLikeWebPart : System.Web.UI.WebControls.WebParts.WebPart
    {
        [WebBrowsable(true), WebDisplayName("Width"), WebDescription("The width of the Like button "), Personalizable(PersonalizationScope.Shared), Category("Properties")]
        public Unit Width
        {
            get
            {
                return _width;
            }
            set
            {
                _width = value;
            }
        }
        private Unit _width;

        [WebBrowsable(true), WebDisplayName("Url"), WebDescription("The URL to like. Href should be an absolute URL "), Personalizable(PersonalizationScope.Shared), Category("Properties")]
        public string Url
        {
            get
            {
                return _url;
            }
            set
            {
                _url = value;
            }
        }
        private string _url;

        [WebBrowsable(true), WebDisplayName("Show Faces"), WebDescription("Specifies whether to display profile photos below the button (standard layout only) "), Personalizable(PersonalizationScope.Shared), Category("Properties")]
        public bool ShowFaces
        {
            get
            {
                return _showFaces;
            }
            set
            {
                _showFaces = value;
            }
        }
        private bool _showFaces;

        [WebBrowsable(true), WebDisplayName("Verb to Display"), WebDescription("The verb to display on the button. Options: 'like', 'recommend' "), Personalizable(PersonalizationScope.Shared), Category("Properties")]
        public FacebookLike.Controls.FacebookLike.VerbToDisplay Verb
        {
            get
            {
                return _verb;
            }
            set
            {
                _verb = value;
            }
        }
        private Ordina.SharePoint.FacebookLike.Controls.FacebookLike.VerbToDisplay _verb;

        [WebBrowsable(true), WebDisplayName("Send Button"), WebDescription("Specifies whether to include a Send button with the Like button"), Personalizable(PersonalizationScope.Shared), Category("Properties")]
        public bool SendButton
        {
            get
            {
                return _sendButton;
            }
            set
            {
                _sendButton = value;
            }
        }
        private bool _sendButton;

        [WebBrowsable(true), WebDisplayName("Color Scheme"), WebDescription("The color scheme for the like button. Options: 'light', 'dark' "), Personalizable(PersonalizationScope.Shared), Category("Properties")]
        public FacebookLike.Controls.FacebookLike.ColorScheme Color
        {
            get
            {
                return _color;
            }
            set
            {
                _color = value;
            }
        }
        private Ordina.SharePoint.FacebookLike.Controls.FacebookLike.ColorScheme _color;

        [WebBrowsable(true), WebDisplayName("Layout Style"), WebDescription("The layout style for the like button "), Personalizable(PersonalizationScope.Shared), Category("Properties")]
        public FacebookLike.Controls.FacebookLike.LayoutStyle Layout
        {
            get
            {
                return _layout;
            }
            set
            {
                _layout = value;
            }
        }
        private Ordina.SharePoint.FacebookLike.Controls.FacebookLike.LayoutStyle _layout;
        
        protected override void CreateChildControls()
        {
            this.Controls.Add(new Ordina.SharePoint.FacebookLike.Controls.FacebookLike() {Width = _width, Url = _url, ShowFaces = _showFaces, Verb = Verb,SendButton = _sendButton, Color = _color, Layout = _layout });
        }
    }
}
